Skip to content

Fix global variables wrongly parsed#233

Open
Lucisu wants to merge 2 commits into
WordPress:masterfrom
Lucisu:fix/global-variables-wrongly-parsed
Open

Fix global variables wrongly parsed#233
Lucisu wants to merge 2 commits into
WordPress:masterfrom
Lucisu:fix/global-variables-wrongly-parsed

Conversation

@Lucisu

@Lucisu Lucisu commented Oct 4, 2022

Copy link
Copy Markdown

Fixes issue #230 by checking if the variable is global before assigning it to the $this->last_doc.

@kkmuffme

kkmuffme commented Apr 3, 2023

Copy link
Copy Markdown

We also need to reset the last doc to null, when we declare a function/method, as otherwise it will apply the tags in cases like:

/**
 * @deprecated some text 
 */
add_filter( 'foo', 'bar' );

/**
 * @deprecated other text
 */
function hello() {
	return apply_filters( 'my_filter', '' );
}

"my_filter" will suddenly have the @deprecated some text comment added, even though it's completely irrelevant

Just add $this->last_doc = null; before this line

array_push( $this->location, $node );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants